{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [],
   "source": [
    "xslpath='/home/b8313/coding/music/music_essay/test/MIDI_numbers_span(15).xlsx'"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "outputs": [],
   "source": [
    "dataf=pd.read_excel(xslpath)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "outputs": [
    {
     "data": {
      "text/plain": "       Unnamed: 0                              filename  sentence_amount  \\\n0               0  000203a04a64ad57329a058f11e235cb.npy               21   \n1               1  00056caa278e4192461ca42ddb952532.npy               22   \n2               2  001784858d9e607c0db054e68cab8c6c.npy               21   \n3               3  001d789d86a9139c710af589a7a5f134.npy               29   \n4               4  00263b5a69674d9f89df481f4253772a.npy               20   \n...           ...                                   ...              ...   \n11671       11671                        YOUVEGOT L.npy                8   \n11672       11672                        YOUVEMAD L.npy               16   \n11673       11673                 YouWereMeantForMe.npy               29   \n11674       11674                        YUAINYET L.npy               21   \n11675       11675                          Zombie-2.npy               15   \n\n      MIDI_numbers_span  \n0              7.857143  \n1              9.681818  \n2               7.52381  \n3              9.551724  \n4                  8.05  \n...                 ...  \n11671             8.125  \n11672            8.9375  \n11673          9.068966  \n11674          7.809524  \n11675          8.666667  \n\n[11676 rows x 4 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Unnamed: 0</th>\n      <th>filename</th>\n      <th>sentence_amount</th>\n      <th>MIDI_numbers_span</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>000203a04a64ad57329a058f11e235cb.npy</td>\n      <td>21</td>\n      <td>7.857143</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1</td>\n      <td>00056caa278e4192461ca42ddb952532.npy</td>\n      <td>22</td>\n      <td>9.681818</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2</td>\n      <td>001784858d9e607c0db054e68cab8c6c.npy</td>\n      <td>21</td>\n      <td>7.52381</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>3</td>\n      <td>001d789d86a9139c710af589a7a5f134.npy</td>\n      <td>29</td>\n      <td>9.551724</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>4</td>\n      <td>00263b5a69674d9f89df481f4253772a.npy</td>\n      <td>20</td>\n      <td>8.05</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>11671</th>\n      <td>11671</td>\n      <td>YOUVEGOT L.npy</td>\n      <td>8</td>\n      <td>8.125</td>\n    </tr>\n    <tr>\n      <th>11672</th>\n      <td>11672</td>\n      <td>YOUVEMAD L.npy</td>\n      <td>16</td>\n      <td>8.9375</td>\n    </tr>\n    <tr>\n      <th>11673</th>\n      <td>11673</td>\n      <td>YouWereMeantForMe.npy</td>\n      <td>29</td>\n      <td>9.068966</td>\n    </tr>\n    <tr>\n      <th>11674</th>\n      <td>11674</td>\n      <td>YUAINYET L.npy</td>\n      <td>21</td>\n      <td>7.809524</td>\n    </tr>\n    <tr>\n      <th>11675</th>\n      <td>11675</td>\n      <td>Zombie-2.npy</td>\n      <td>15</td>\n      <td>8.666667</td>\n    </tr>\n  </tbody>\n</table>\n<p>11676 rows × 4 columns</p>\n</div>"
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "169\n",
      "458\n",
      "498\n",
      "1233\n",
      "1356\n",
      "2772\n",
      "2881\n",
      "2890\n",
      "2993\n",
      "3327\n",
      "3950\n",
      "4317\n",
      "4621\n",
      "4735\n",
      "5125\n",
      "5879\n",
      "6074\n",
      "6365\n",
      "6375\n",
      "6394\n",
      "6727\n",
      "6883\n",
      "6884\n",
      "7749\n",
      "9038\n",
      "10780\n",
      "10870\n",
      "10930\n",
      "11605\n"
     ]
    }
   ],
   "source": [
    "total_amount=0\n",
    "total_sentence=0\n",
    "for i,r in dataf.iterrows():\n",
    "    # print(float(r['MIDI_numbers_span']))\n",
    "    try:\n",
    "        total_amount+=r['sentence_amount']*float(r['MIDI_numbers_span'])\n",
    "        total_sentence+=r['sentence_amount']\n",
    "    except ValueError:\n",
    "        print(i)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "outputs": [
    {
     "data": {
      "text/plain": "209540"
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total_sentence"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "outputs": [
    {
     "data": {
      "text/plain": "2039573.0"
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total_amount"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "outputs": [
    {
     "data": {
      "text/plain": "9.733573542044478"
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total_amount/total_sentence"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "outputs": [],
   "source": [
    "xslpath='/home/b8313/coding/music/music_essay/test/sum_time_length_of_every_sentence(15).xlsx'"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "outputs": [],
   "source": [
    "dataf=pd.read_excel(xslpath)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "169\n",
      "458\n",
      "498\n",
      "1233\n",
      "1356\n",
      "2772\n",
      "2881\n",
      "2890\n",
      "2993\n",
      "3327\n",
      "3950\n",
      "4317\n",
      "4621\n",
      "4735\n",
      "5125\n",
      "5879\n",
      "6074\n",
      "6365\n",
      "6375\n",
      "6394\n",
      "6727\n",
      "6883\n",
      "6884\n",
      "7749\n",
      "9038\n",
      "10780\n",
      "10870\n",
      "10930\n",
      "11605\n"
     ]
    },
    {
     "data": {
      "text/plain": "(209540, 209540, 33.12817242531259)"
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "total_amount=0\n",
    "total_sentence=0\n",
    "for i,r in dataf.iterrows():\n",
    "    # print(float(r['MIDI_numbers_span']))\n",
    "    try:\n",
    "        total_amount+=r['sentence_amount']*float(r['sum_time_length_of_every_sentence(15)'])\n",
    "        total_sentence+=r['sentence_amount']\n",
    "    except ValueError:\n",
    "        print(i)\n",
    "\n",
    "\n",
    "total_sentence,total_sentence,total_amount/total_sentence"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "outputs": [],
   "source": [
    "xslpath='/home/b8313/coding/music/music_essay/test/Number_of_rest_in_every_sentence(15).xlsx'"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "169\n",
      "458\n",
      "498\n",
      "1233\n",
      "1356\n",
      "2772\n",
      "2881\n",
      "2890\n",
      "2993\n",
      "3327\n",
      "3950\n",
      "4317\n",
      "4621\n",
      "4735\n",
      "5125\n",
      "5879\n",
      "6074\n",
      "6365\n",
      "6375\n",
      "6394\n",
      "6727\n",
      "6883\n",
      "6884\n",
      "7749\n",
      "9038\n",
      "10780\n",
      "10870\n",
      "10930\n",
      "11605\n"
     ]
    },
    {
     "data": {
      "text/plain": "(209540, 209540, 3.556375870955426)"
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf=pd.read_excel(xslpath)\n",
    "total_amount=0\n",
    "total_sentence=0\n",
    "for i,r in dataf.iterrows():\n",
    "    # print(float(r['MIDI_numbers_span']))\n",
    "    try:\n",
    "        total_amount+=r['sentence_amount']*float(r['Number_of_rest_in_every_sentence'])\n",
    "        total_sentence+=r['sentence_amount']\n",
    "    except ValueError:\n",
    "        print(i)\n",
    "\n",
    "\n",
    "total_sentence,total_sentence,total_amount/total_sentence"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "outputs": [],
   "source": [
    "xslpath='/home/b8313/coding/music/music_essay/test/Sum_length_of_rest_value_in_every_sentence(15).xlsx'"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "169\n",
      "458\n",
      "498\n",
      "1233\n",
      "1356\n",
      "2772\n",
      "2881\n",
      "2890\n",
      "2993\n",
      "3327\n",
      "3950\n",
      "4317\n",
      "4621\n",
      "4735\n",
      "5125\n",
      "5879\n",
      "6074\n",
      "6365\n",
      "6375\n",
      "6394\n",
      "6727\n",
      "6883\n",
      "6884\n",
      "7749\n",
      "9038\n",
      "10780\n",
      "10870\n",
      "10930\n",
      "11605\n"
     ]
    },
    {
     "data": {
      "text/plain": "(209540, 209540, 0.8722465082243701)"
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf=pd.read_excel(xslpath)\n",
    "total_amount=0\n",
    "total_sentence=0\n",
    "for i,r in dataf.iterrows():\n",
    "    # print(float(r['MIDI_numbers_span']))\n",
    "    try:\n",
    "        total_amount+=r['sentence_amount']*float(r['Sum_length_of_rest_value_in_every_sentence'])\n",
    "        total_sentence+=r['sentence_amount']\n",
    "    except ValueError:\n",
    "        print(i)\n",
    "\n",
    "\n",
    "total_sentence,total_sentence,total_amount/total_sentence"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [],
   "source": [
    "xslpath='/home/b8313/coding/music/music_essay/test/Number_of_Unique_MIDI_note_in_every_sentence.xlsx'\n",
    "import pandas as pd"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "169\n",
      "458\n",
      "498\n",
      "1233\n",
      "1356\n",
      "2772\n",
      "2881\n",
      "2890\n",
      "2993\n",
      "3327\n",
      "3950\n",
      "4317\n",
      "4621\n",
      "4735\n",
      "5125\n",
      "5879\n",
      "6074\n",
      "6365\n",
      "6375\n",
      "6394\n",
      "6727\n",
      "6883\n",
      "6884\n",
      "7749\n",
      "9038\n",
      "10780\n",
      "10870\n",
      "10930\n",
      "11605\n"
     ]
    },
    {
     "data": {
      "text/plain": "(209540, 209540, 5.250591772453947)"
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf=pd.read_excel(xslpath)\n",
    "total_amount=0\n",
    "total_sentence=0\n",
    "for i,r in dataf.iterrows():\n",
    "    # print(float(r['MIDI_numbers_span']))\n",
    "    try:\n",
    "        total_amount+=r['sentence_amount']*float(r['Number_of_Unique_MIDI_note_in_every_sentence'])\n",
    "        total_sentence+=r['sentence_amount']\n",
    "    except ValueError:\n",
    "        print(i)\n",
    "\n",
    "\n",
    "total_sentence,total_sentence,total_amount/total_sentence"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}